package com.ashion.findfuny;

import java.util.List;
import java.util.Map;

import android.content.Context;
import android.content.Intent;
import android.graphics.drawable.Drawable;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.TranslateAnimation;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.ProgressBar;
import android.widget.TextView;

import com.ashion.findfuny.AsyncImageLoader.ImageCallback;

public class DetailListAdapter extends BaseAdapter{

	private static final String TAG = DetailListAdapter.class.getSimpleName();
	private Context context;
	private LayoutInflater mInflater;
	private List<Map<String, Object>> mListData;
	private AsyncImageLoader asyncImageLoader;
	private ListView listView;
	private boolean isShowProgress;
	private ProgressBar progress;
	
    public DetailListAdapter(Context context,ListView listView, List<Map<String, Object>> mListData){
        this.mInflater = LayoutInflater.from(context);
        this.mListData = mListData;
        this.context = context;
        this.listView = listView;
        asyncImageLoader = new AsyncImageLoader();

    }
    @Override
    public int getCount() {
        // TODO Auto-generated method stub
        return mListData.size();
    }

    @Override
    public Object getItem(int arg0) {
        // TODO Auto-generated method stub
        return null;
    }

    @Override
    public long getItemId(int arg0) {
        // TODO Auto-generated method stub
        return 0;
    }

    public void setProgressVisiable(boolean flag){
    	progress.setVisibility(flag?View.VISIBLE:View.GONE);
    }
    
    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        
        ViewHolder holder = null;
        if (convertView == null) {
             
            holder=new ViewHolder();  
            convertView = mInflater.inflate(R.layout.detail_list_item, null);
            holder.image = (ImageView)convertView.findViewById(R.id.item_image);
            holder.comment = (TextView)convertView.findViewById(R.id.item_comment);
            holder.user = (TextView)convertView.findViewById(R.id.item_user);
            convertView.setTag(holder);
            convertView.setClickable(true);
        }else {
            holder = (ViewHolder)convertView.getTag();
        }
        
        
        Map<String, Object> map = mListData.get(position); 
        holder.comment.setText((String)map.get(CommonUtil.TITLE));
        holder.user.setText((String)map.get(CommonUtil.USER));
         
        return convertView;
    }
     
    
    class ViewHolder{
    	private ImageView image;
    	private TextView comment;
    	private TextView user;
    }
    
    
}
